//
//  SecondViewController.m
//  UI_Homework_08_02
//
//  Created by 黄威 on 16/5/12.
//  Copyright © 2016年 黄威. All rights reserved.
//

#import "SecondViewController.h"

@interface SecondViewController ()

@end

@implementation SecondViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self create];
    // Do any additional setup after loading the view.
}




-(void)create{

 UIScrollView *scroll = [[UIScrollView alloc]initWithFrame:[UIScreen mainScreen].bounds];
    UIPageControl *page = [[UIPageControl alloc]initWithFrame:CGRectMake(100, 620, 200, 40)];
    page.backgroundColor = [UIColor purpleColor];

    
    
    scroll.contentSize = CGSizeMake(375 * 10, 0);
    
    page.numberOfPages = 10;
    page.currentPage = 2;
    
    
    for (NSInteger i = 0; i < 10; i++) {
        UIImageView *imageView =[[UIImageView alloc]initWithFrame:CGRectMake((i - 1)* 375, 0,375, 675)];
       
        imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"%ld.jpg", i]];
                    [scroll addSubview:imageView];
                    [imageView release];
        scroll.contentOffset = CGPointMake(375, 0);                             }
    scroll.pagingEnabled = YES;
    [self.view addSubview:scroll];
    [self.view addSubview:page];
    
    

}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
